The superior gluteal nerve arises from the dorsal branches of the ventral rami of L4, L5 and S1.  It leaves the pelvis through the greater sciatic foramen, above piriformis, accompanied by the superior gluteal vessels.  It divides into superior and inferior branches, which follow the course of the upper and lower branches of the deep division of the superior gluteal artery, respectively.

Supply
Its superior branch supplies gluteus medius and possibly minimus; the inferior branch supplies gluteus medius, minimus and tensor fascia lata.